package com.winterwar.service.impl;

import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.winterwar.base.Slot;
import com.winterwar.dao.SlotDAO;
import com.winterwar.service.SlotManager;

public class SlotManagerImpl implements SlotManager {

	public Slot get(String slotID) {
		Slot slot = dao.get(Integer.valueOf(slotID));
		if(slot == null){
			log.warn("Slot with ID " + slotID + " is not present in the database.");
		}
		return slot;
	}

	public List getAll() {
		return dao.getAll();
	}

	public void remove(String slotID) {
		dao.remove(Integer.valueOf(slotID));
	}

	public Slot save(Slot slot) {
		dao.save(slot);
		return slot;
	}

	public void setDAO(SlotDAO dao) {
		this.dao = dao;
	}
	
	private SlotDAO dao;
	private static Log log = LogFactory.getLog(SlotManager.class);

	public List getAllByCon(String conID) {
		return dao.getByConID(Integer.valueOf(conID));
	}
}
